package cn.tedu.domain;

import javax.validation.constraints.*;

public class User {
    int id;

    @NotNull
    @NotEmpty(message = "用户名不能为空")
    String username;

    @NotNull
    @NotEmpty(message = "密码不能为空")
    @Size(min = 3, max = 16)
    String password;

    @NotNull
    @NotEmpty
    @Pattern(regexp = "^[a-zA-Z]\\w*$", message = "昵称必须以字母开头")
    String nickname;

    @NotNull
    @NotEmpty(message = "邮箱不能为空")
    @Email(message = "邮箱必须符合格式")
    String email;

    public User() {
    }

    public User(int id, String username, String password, String nickname, String email) {
        this.id = id;
        this.username = username;
        this.password = password;
        this.nickname = nickname;
        this.email = email;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", username='" + username + '\'' +
                ", password='" + password + '\'' +
                ", nickname='" + nickname + '\'' +
                ", email='" + email + '\'' +
                '}';
    }
}
